import java.util.Scanner;

public class 递归求解汉诺塔问题 {
    //递归求解汉诺塔问题
    public static void hannnuoda(int n, char f , char a, char t){
        if(n==1){
            System.out.println("移动一个从"+f+"到"+t);
            return ;
        }
        hannnuoda(n-1,f,t,a);
        System.out.println("移动"+n+"从"+f+"到"+t);
        hannnuoda(n-1,a,f,t);
    }
    public static void main(String[]args){
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        char f = 'a';
        char a = 'b';
        char t = 'c';
        hannnuoda(n , f , a , t);

    }
}
